package com.singfan.script;

import com.singfan.core.SingFanContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 脚本执行的上下文环境
 * Author: hansonghe
 * Date: 2015-08-20 16:47
 * Desc: 主要用于获取spring的context
 */
public class ScriptContext {
    private static ApplicationContext springContext;
    public static void init(){
        System.out.print("ScriptContext init begin ...");
        SingFanContext.init();
        springContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        System.out.print("ScriptContext init successful !");
    }

    public static ApplicationContext getSpringContext(){
        return springContext;
    }
}
